var tabs = document.getElementById("tabs").getElementsByTagName("li");
console.log(tabs);
var lists = document.getElementById("lists").getElementsByTagName("ul");
console.log(lists);
for (var i = 0; i < tabs.length; i++) {
    tabs[i].onclick = showlist;
}

function showlist() {
    for (var i = 0; i < tabs.length; i++)
        if (tabs[i] === this) {
            lists[i].className = "clearfix active1";
            tabs[i].className = "active";
        } else {
            tabs[i].className = "";
            lists[i].className = "clearfix";
        }
}
var seckilltime = document.getElementById("seckilltime1");
// alert(seckilltime.value);
// alert(seckilltime.value.getTime())

var mr1 = new Date(document.getElementById("seckilltime1").value)
// alert(mr1);
function boxseckil() {
    let boxseckilltime1 = document.getElementById("box_seckill_time");
    //定义秒杀活动开始时间
    // let boxseckill = new Date(seckilltime.value);
    //获取当前系统时间
    let now = new Date();
    //相差的秒数
    let d = (seckilltime.value - now) / 1000;
    if (d <= 0) {
        console.log('---');
        clearInterval(dt);
    }
    //获取相差的天数
    let day = parseInt((d/60/60/24));
    //获取相差的小时数
    let hours = parseInt((d/60/60)%24);
    //获取相差的分数
    let  minutes = parseInt((d/60)%60);
    //获取相差的秒
    let seconds = parseInt(d%60);
    boxseckilltime1.innerHTML=day+"天"+hours+"时"+minutes+"分"+seconds+"秒";

}
let dt = setInterval(boxseckil,1000);


